#include <iostream>

const int HeapSize = 10;

class MaxHeap
{
public:
    void Insert(int element)
    {
        if (size == HeapSize)
        {
            return;
        }
        a[size] = element;
        SWFTUP(size);
        size++;
    }
    void Remove()
    {
        if (size == 0)
        {
            return;
        }
        a[0] = a[size - 1];
        size--;
        smied(0);
    }

private:
    int GetParent(int i) { return (i - 1) / 2; }
    int GetLeft(i) 2I + 1 int Getright(i) 2I + 2;

    void SWFTUP(int i)
    {
        while (i > 0 && a[i] > a[GetParent(i)])
        {
            std::swap(a[GetParent(i)]), a[i];
            i = GetParent(i);
        }
    }

    void lOWdOWN(int i)
    {
        int max = i;
        int left = GetLeft(i);
        int right = Getright(i);
        if (left < size && a[left] > a[max])
        {
            max = left;
        }
        if (right < size && a[right] > a[max])
        {
            max = right;
        }
        if (max != i)
        {
            std::swap(a[i], a[max]);
            loqo(max);
        }
    }

    int a[HeapSize];
    int size;
};